﻿/**
*    @file:    DeviceMonitorHeader.h
*    @brief:
*    @author:  sanshi522@163.com
*    @date:    2025-04-13  16:11
*/
#ifndef DEVICEMONITORHEADER_H
#define DEVICEMONITORHEADER_H
#include <QtCore>

using namespace std;

//================================数据帧长
#define TCP_SOCKET_FRAME_LEN 65536
#define UDP_SOCKET_FRAME_LEN 1472
//================================报文同步头
#define TCP_SYNC_MARK 0xFEEF3811
#define UDP_SYNC_MARK 0xFEEF8181
//================================包标识类型
#define FRAME_MARK_CENTER 0 //中间帧
#define FRAME_MARK_END 1 //结束帧

#pragma pack(push, 1)
/**
 * @brief The SocketFrameHeader struct TCP数据帧头
 */
struct SocketFrameHeader
{
    uint32_t syncMark;    //同步标志
    uint16_t packId;      //包ID
    uint32_t packLen;     //包长
    uint8_t frameMark;    //帧标志
    uint32_t frameSerial; //帧序号
    uint32_t dataLen;     //数据长度
    char keep[5];         //保留
    SocketFrameHeader()
    {
        syncMark = TCP_SYNC_MARK;
    }
};
/**
 * @brief The SocketFrameHeader struct UDP数据帧头
 */
struct UdpSocketFrameHeader
{
    uint32_t syncMark;    //同步标志
    uint16_t packId;      //包ID
    uint32_t packLen;     //包长
    uint8_t frameMark;    //帧标志
    uint32_t frameSerial; //帧序号
    uint32_t dataLen;     //数据长度
    char keep[5];         //保留
    UdpSocketFrameHeader()
    {
        syncMark = UDP_SYNC_MARK;
    }
};
#pragma pack(pop)
#endif // DEVICEMONITORHEADER_H
